
export interface ProductSaveType {
  product_pic: string
  product_name: string
  category_id: string
  brand_id: string
  product_count: number
  product_money: number
  product_address: string
}

export interface ProductDeleteType {
  product_id: string
}
export interface ProductUpdateType extends ProductSaveType, ProductDeleteType{}

export interface productListType extends ProductSaveType, ProductDeleteType{
  hot: string,
  category_name: string
  brand_name: string,
  discount: number
}

export interface ProductIsHotType {
  product_id: string
  hot: '0'|'1'
}

export interface ProductFormType {
  product_name: string
  hot: '0'|'1'|''
}

export type DiscountType = {
  product_id: string,
  discount: number
}

export const productColumns = (h) => [
  {
    title: "商品图片",
    align: 'center',
    key: "product_pic",
    render: (r:ProductUpdateType) => h(r, 'product_pic')
  },
  {
    title: "商品名称",
    align: 'center',
    key: "product_name"
  },
  {
    title: "商品分类",
    align: 'center',
    key: "category_name"
  },
  {
    title: "商品品牌",
    align: 'center',
    key: "brand_name"
  },
  {
    title: "发货地址",
    align: 'center',
    key: "product_address"
  },
  {
    title: "商品数量",
    align: 'center',
    key: "product_count"
  },
  {
    title: "商品价格",
    align: 'center',
    key: "product_money"
  },
  {
    title: "折扣价格",
    align: 'center',
    key: "discount"
  },
  {
    title: "首页推荐",
    align: 'center',
    key: "hot",
    render: (r) => {
      if (r.hot === '0') {
        return '否'
      }
      if (r.hot === '1') {
        return '是'
      }
    }
  },
  {
    title:"操作",
    key: "product_id",
    align: 'center',
    render: (r:ProductUpdateType) => h(r, 'product_id'),
    width: 310
  }
]


export const productSelectHot = [
  {
    label: "全部",
    value: ''
  },
  {
    label: "是",
    value: '1'
  },
  {
    label: "否",
    value: '0'
  }
]


export type ColorSaveType = {
  product_color_pic: string
  product_color_name: string
  product_color_count: number
  product_id: string
}
export type ColorUpdate = ColorSaveType & {
  id: number
}


export type PicList = {
  id: number,
  product_id: string,
  label: string
  value: string
}
export type InfoListType = {
  label: string
  value: string
}


export type pic = {
  id: number,
  product_pic_url: string
  product_id: string
}
export type infoPic = {
  pic: string
  product_id: string
  id: number
}
